﻿using System;
using System.Collections.Generic;
using YArchitech.Temp;

namespace YArchitech.Plumbing
{
	public class HYPlumbingObject : HYObject, IHYXmlSerial
	{
		public HYPlumbingObject()
		{
			this.Index = 0;
			this.Name = "实体";
			this.Length = 0.0;
			this.ButtonElevation = 0.0;
			this.Velocity = 0.0;
			this.Flow = 0.0;
			this.Previous = null;
			this.LossPipe = 0.0;
			this.LossPart = 0.0;
			this.LossAll = 0.0;
		}

		public int Index { get; set; }

		public string Name { get; set; }

		public string Number { get; set; }

		public double Length { get; set; }

		public double ButtonElevation { get; set; }

		public double Velocity { get; set; }

		public double Flow { get; set; }

		public double LossPipe { get; set; }

		public double LossPart { get; set; }

		public double LossAll { get; set; }

		public HYPlumbingObject Previous { get; set; }

		public void ClearPrevious()
		{
			if (this.subObjectArray != null)
			{
				this.subObjectArray.Clear();
			}
		}

		public virtual void AddNext(HYPlumbingObject nextObj)
		{
			if (nextObj == null)
			{
				return;
			}
			if (this.subObjectArray.Contains(nextObj))
			{
				return;
			}
			this.subObjectArray.Add(nextObj);
			nextObj.Previous = this;
		}

		public List<HYPlumbingObject> subObjectArray = new List<HYPlumbingObject>();
	}
}
